package com.ktjy.config;

import com.ktjy.pojo.SysRole;
import com.ktjy.pojo.SysUser;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@PropertySource(value = "classpath:database.properties", encoding = "UTF-8")
@Configuration
public class JavaConfig1 {

    @Value("${user.account}")
    private String account;

    @Value("${user.realName}")
    private String realName;

    public void show() {
        System.out.println(this.account);
        System.out.println(this.realName);
    }

    @Bean
    public SysUser wangwu(@Qualifier(value = "managerRole") SysRole aaaaa) {
        System.out.println(aaaaa.getRoleName());
        return new SysUser();
    }

    @Bean
    public SysRole managerRole() {
        SysRole role = new SysRole();
        role.setRoleName("管理人员");
        return role;
    }

    @Bean
    public SysRole empRole() {
        return new SysRole();
    }

}
